Skip to content

Query the backend to get the fqbn when a core is not installed #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 9, 2019

Conversation

masci
Copy link
Contributor

@masci masci commented Aug 9, 2019

This PR makes the command arduino-cli board list properly work even when a core for the connected board is not installed. It works by querying the Arduino Cloud backend passing VID and PID, hence the CLI must be able to access the Internet for this to work.

@masci masci added this to the 0.5.0 milestone Aug 9, 2019
Copy link
Contributor

@mastrolinux mastrolinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later on we could remove the builder api endpoint being directly in the code and put it somewhere else as a variable. But OK for now!

retVal := []*rpc.BoardListItem{}
req, _ := http.NewRequest("GET", url, nil)
req.Header = globals.HTTPClientHeader
req.Header.Set("Content-Type", "application/json")
Copy link
Contributor

@mattiabertorello mattiabertorello Aug 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you put the user-agent header?
An example could be this one https://github.com/arduino/Arduino/blob/324a9bcbbbe540d133604767b5c4d30c5f62c753/arduino-core/src/cc/arduino/utils/network/HttpConnectionManager.java#L59
Example

final String defaultUserAgent = String.format(
      "ArduinoIDE/%s (%s; %s; %s; %s) Java/%s (%s)",
      BaseNoGui.VERSION_NAME,
      System.getProperty("os.name"),
      System.getProperty("os.version"),
      System.getProperty("os.arch"),
      System.getProperty("user.language"),
      System.getProperty("java.version"),
      System.getProperty("java.vendor")
    );

Copy link
Contributor Author

@masci masci Aug 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user agent is already there, see how globals.HTTPClientHeader is initialized

Co-Authored-By: Maurizio Branca <[email protected]>
@masci masci merged commit f2d14b2 into master Aug 9, 2019
@masci masci deleted the massi/board-list-query branch August 9, 2019 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants